package com.edushare.common.standalonetests;


public class InsertCourseUnivLink {

	public static void main(String[] args) {/*
		
		DataContext ctx  = DataContext.createDataContext();
		
		*//** University 1 *//*
		Universities u1 = (Universities)ctx.newObject(Universities.class);
		u1.setUniversityName("University 1");
		u1.setUniversityDesc("This is Univ-1");
		u1.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		*//** University 2 *//*
		Universities u2 = (Universities)ctx.newObject(Universities.class);
		u2.setUniversityName("University 2");
		u2.setUniversityDesc("This is Univ-2");
		u2.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		*//** Create Association *//*
		AssociationTypes assc1 = (AssociationTypes)ctx.newObject(AssociationTypes.class);
		assc1.setAssociationName("Owned");
		assc1.setAssociationCode(1);
		
		AssociationTypes assc2 = (AssociationTypes)ctx.newObject(AssociationTypes.class);
		assc2.setAssociationName("Affiliated");
		assc2.setAssociationCode(2);
		
		*//** Create course categories *//*
		CourseCategories cc1 = (CourseCategories)ctx.newObject(CourseCategories.class);
		cc1.setCourseCategoryName("Mechanical Engineering");
		
		CourseCategories cc2 = (CourseCategories)ctx.newObject(CourseCategories.class);
		cc2.setCourseCategoryName("Electrical Engineering");
		
		CourseCategories cc3 = (CourseCategories)ctx.newObject(CourseCategories.class);
		cc3.setCourseCategoryName("Marine Engineering");
		
		*//** create courses *//*
		//Thermodynamics
		Courses c1 = (Courses)ctx.newObject(Courses.class);
//		c1.setCourseCategory(cc1);
		c1.setCourseName("Thermodynamics");
		c1.setCourseDesc("Stupid stuffs about things getting hot and cool");
		c1.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		//Mechanics
		Courses c2 = (Courses)ctx.newObject(Courses.class);
//		c2.setCourseCategory(cc1);
		c2.setCourseName("Mechanics");
		c2.setCourseDesc("Pretty simple stuffs in complicated way");
		c2.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		//Electric Machines
		Courses c3 = (Courses)ctx.newObject(Courses.class);
//		c3.setCourseCategory(cc2);
		c3.setCourseName("Electric Machines");
		c3.setCourseDesc("Stuffs about Fans and Chinese Toys");
		c3.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		//Fluid Mech
		Courses c4 = (Courses)ctx.newObject(Courses.class);
//		c4.setCourseCategory(cc1);
		c4.setCourseName("Fluid Mechanics");
		c4.setCourseDesc("About water and pipes");
		c4.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		//Control Systems
		Courses c5 = (Courses)ctx.newObject(Courses.class);
//		c5.setCourseCategory(cc2);
		c5.setCourseName("Control Systems");
		c5.setCourseDesc("Controling uncontrolled things");
		c5.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		//Naval Architecture
		Courses c6 = (Courses)ctx.newObject(Courses.class);
//		c6.setCourseCategory(cc3);
		c6.setCourseName("Naval Architecture");
		c6.setCourseDesc("Converting paper boats to metal ones");
		c6.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		//Sea Waves
		Courses c7 = (Courses)ctx.newObject(Courses.class);
//		c7.setCourseCategory(cc3);
		c7.setCourseName("Sea Waves");
		c7.setCourseDesc("Why does Baywatch sell?");
		c7.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		
		
		//Associated Them all
		UniversityCourseLinks link1 = (UniversityCourseLinks)ctx.newObject(UniversityCourseLinks.class);
		link1.setUniversity(u1);
		link1.setCourse(c1);
		link1.setAssociationType(assc1);
		link1.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		UniversityCourseLinks link2 = (UniversityCourseLinks)ctx.newObject(UniversityCourseLinks.class);
		link2.setUniversity(u1);
		link2.setCourse(c2);
		link2.setAssociationType(assc1);
		link2.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		UniversityCourseLinks link3 = (UniversityCourseLinks)ctx.newObject(UniversityCourseLinks.class);
		link3.setUniversity(u1);
		link3.setCourse(c3);
		link3.setAssociationType(assc1);
		link3.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		UniversityCourseLinks link4 = (UniversityCourseLinks)ctx.newObject(UniversityCourseLinks.class);
		link4.setUniversity(u1);
		link4.setCourse(c4);
		link4.setAssociationType(assc1);
		link4.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		UniversityCourseLinks link5 = (UniversityCourseLinks)ctx.newObject(UniversityCourseLinks.class);
		link5.setUniversity(u1);
		link5.setCourse(c5);
		link5.setAssociationType(assc1);
		link5.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		UniversityCourseLinks link6 = (UniversityCourseLinks)ctx.newObject(UniversityCourseLinks.class);
		link6.setUniversity(u1);
		link6.setCourse(c6);
		link6.setAssociationType(assc2);
		link6.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		UniversityCourseLinks link7 = (UniversityCourseLinks)ctx.newObject(UniversityCourseLinks.class);
		link7.setUniversity(u1);
		link7.setCourse(c7);
		link7.setAssociationType(assc2);
		link7.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		UniversityCourseLinks link8 = (UniversityCourseLinks)ctx.newObject(UniversityCourseLinks.class);
		link8.setUniversity(u2);
		link8.setCourse(c6);
		link8.setAssociationType(assc1);
		link8.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		UniversityCourseLinks link9 = (UniversityCourseLinks)ctx.newObject(UniversityCourseLinks.class);
		link9.setUniversity(u2);
		link9.setCourse(c7);
		link9.setAssociationType(assc1);
		link9.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
		
		//persist in DB
		ctx.commitChanges();
		
	*/}

}